//
//  FirstCollectionViewCell.m
//  半糖
//
//  Created by RenShuang on 15-9-9.
//  Copyright (c) 2015年 shuang. All rights reserved.
//

#import "FirstCollectionViewCell.h"
#import "BaseHeader.h"

@implementation FirstCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, (SCREEN_WIDTH-30)/2, (SCREEN_WIDTH-30)*3/4)];
        _bgImageView.image = [UIImage imageNamed:@"bg.jpg"];
        [self.contentView addSubview:_bgImageView];
        [_bgImageView release];
        
        self.myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, (SCREEN_WIDTH-30)/2, (SCREEN_WIDTH-30)/2)];
        [self.contentView addSubview:_myImageView];
        [_myImageView release];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, (SCREEN_WIDTH-30)/2, (SCREEN_WIDTH-30)/2, (SCREEN_WIDTH-30)/10)];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.font = [UIFont systemFontOfSize:16.];
        [self.contentView addSubview:_titleLabel];
        [_titleLabel release];
        
        self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, (SCREEN_WIDTH-30)*3/5, (SCREEN_WIDTH-30)/2, (SCREEN_WIDTH-30)/15)];
        _priceLabel.textColor = [UIColor redColor];
        _priceLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_priceLabel];
        [_priceLabel release];
    }
    return self;
}

- (void)getCell:(firstTitleDetailCollectionModel *)model
{
    [_myImageView sd_setImageWithURL:[NSURL URLWithString:model.pic]];
    [_titleLabel setText:model.title];
    [_priceLabel setText:model.price];
}

@end
